﻿<Page 
    x:Class="PerspectiveDemo.Wpf3D.View.ButtonFaderKnob3DDemo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:p="http://www.codeplex.com/perspective"
    Title="Range3D controls"
    Style="{StaticResource PageStyle}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Wpf3DResources.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <p:Fader3D x:Key="Fader1" Minimum="0.0" Maximum="2.0">
                <p:Fader3D.Transform>
                    <Transform3DGroup>
                        <TranslateTransform3D OffsetX="2.0" OffsetY="0.5"/>
                    </Transform3DGroup>
                </p:Fader3D.Transform>
            </p:Fader3D>
            <p:Knob3D x:Key="Knob1" Minimum="0.0" Maximum="360.0">
                <p:Knob3D.Transform>
                    <Transform3DGroup>
                        <TranslateTransform3D OffsetX="4.0" OffsetY="1.5"/>
                    </Transform3DGroup>
                </p:Knob3D.Transform>
            </p:Knob3D>
        </ResourceDictionary>
    </Page.Resources>
    <p:Workshop3D>
        <ContainerUIElement3D AutomationProperties.AutomationId="containerUIElement3D1">
            <ContainerUIElement3D.Transform>
                <Transform3DGroup>
                    <TranslateTransform3D OffsetX="-2.5" />
                    <ScaleTransform3D ScaleX="0.5" ScaleY="0.5" ScaleZ="0.5" />
                </Transform3DGroup>
            </ContainerUIElement3D.Transform>
            <p:Box3D Material="{DynamicResource FrontMaterial}">
                <p:Box3D.Transform >
                    <Transform3DGroup>
                        <ScaleTransform3D ScaleX="5.0" ScaleY="3.0" />
                        <TranslateTransform3D OffsetZ="-1.001" />
                    </Transform3DGroup>
                </p:Box3D.Transform>
            </p:Box3D>
            <p:Button3D AutomationProperties.AutomationId="b3D1" Click="Button3D_Click">
                <p:Button3D.Transform>
                    <Transform3DGroup>
                        <TranslateTransform3D OffsetX="0.5" OffsetY="1.0" />
                    </Transform3DGroup>
                </p:Button3D.Transform>
            </p:Button3D>
            <StaticResource ResourceKey="Fader1"/>
            <StaticResource ResourceKey="Knob1"/>
        </ContainerUIElement3D>

        <p:Arrow3D x:Name="arrow1" Material="{StaticResource GlossyMaterial}" >
            <p:Arrow3D.Transform >
                <Transform3DGroup>
                    <RotateTransform3D CenterZ="0.5">
                        <RotateTransform3D.Rotation>
                            <AxisAngleRotation3D 
                                x:Name="arrowRotation2"
                                Angle="{Binding Source={StaticResource Knob1}, Path=Value}"
                                Axis="1.0, 0.0, 0.0"/>
                            <!-- 
                                Remark : Binding between elements using ElementName is not supported in a Workshop3D, 
                                because it is not possible to get an inheritance context pointer. 
                                Use the Source or RelativeSource property. 
                                See http://blogs.msdn.com/nickkramer/archive/2006/08/18/705116.aspx
                            -->
                            <!--Angle="{Binding ElementName=knob1, Path=Value}"-->
                        </RotateTransform3D.Rotation>
                    </RotateTransform3D>
                    <TranslateTransform3D 
                        OffsetX="2.0" 
                        OffsetY="{Binding Source={StaticResource Fader1}, Path=Value}"/>
                    <RotateTransform3D CenterX="0.0" CenterZ="0.0">
                        <RotateTransform3D.Rotation>
                            <AxisAngleRotation3D 
                                x:Name="arrowRotation"    
                                Axis="0.0, 1.0, 0.0"/>
                        </RotateTransform3D.Rotation>
                    </RotateTransform3D>
                </Transform3DGroup>
            </p:Arrow3D.Transform>
        </p:Arrow3D>

    </p:Workshop3D>
</Page>
